<template>
  <div class="container">
    <el-dialog
      title="题目审核"
      :visible="showPreview"
      width="20%"
      @close="closeCheck"
    >
      <span>
        <el-radio v-model="radio" label="1">通过</el-radio>
        <el-radio v-model="radio" label="2">拒绝</el-radio>
        <el-input
          type="textarea"
          :rows="3"
          placeholder="请输入内容"
          v-model="textarea"
        >
        </el-input>
      </span>
      <span slot="footer">
        <el-button @click="$emit('close-dialog')">取消</el-button>
        <el-button @click="confirm" type="primary">确认</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions.js'
export default {
  props: {
    showPreview: { type: Boolean, required: true },
    curId: {
      type: Number
    }
  },
  data () {
    return {
      radio: '1',
      textarea: ''
    }
  },
  methods: {
    // 提交审核
    async confirm () {
      await choiceCheck({
        id: this.curId,
        chkState: +this.radio,
        chkRemarks: this.textarea
      })
      this.closeCheck()
    },
    closeCheck () {
      this.$emit('close-dialog')
    }
  }
}
</script>

<style scoped lang='less'></style>
